//
// Created by dong on 2025/10/20.
//

#ifndef BASEC_SBUTTON_H
#define BASEC_SBUTTON_H
#include "SWidget.h"


class SButton:public Swidget
{
public:
    SButton(const std::string& text,Swidget* parent=nullptr);
    void paintEvent(SDL_Event* msg) override;
    void mousePressEvent(SDL_Event* msg) override;
    void mouseMoveEvent(SDL_Event* msg) override;

public:
    template<typename pr,typename ...Args>
    void connect(pr&& f,Args&& ...args)
    {
        func = bind(forward<pr>(f),forward<Args>(args)...);
    }
protected:
    string m_text;
    function<void()> func;

};


#endif //BASEC_SBUTTON_H